public class demo02 {
    //路径
    public static void main(String[] args) {
        int[] arr=new int[2022];
        for (int i = 2; i < 2022; i++) {
            arr[i]=Integer.MAX_VALUE;
        }
        for (int i = 1; i <= 2021; i++) {
            for (int j = i+1; j <= 2021; j++) {
                if(j-i<=21) {
                    int len = i * j / max(i, j);
                    arr[j]=Math.min(arr[j],arr[i]+len);
                }
            }
        }
        System.out.println(arr[2021]);
    }
    public static int max(int a,int b){
        while (a%b!=0){
            int c=a%b;
            a=b;
            b=c;
        }
        return b;
    }
}
